config = require '../config'
resErr = require('./util').resErr
db = require('../config').mongoose.db
ObjectId = require('mongoose').Types.ObjectId

# exports.video_play_numsadd = (req,res) ->
#   return resErr res,'_id不得为空' if !req.param("_id")
#   return resErr res,'video_category不得为空' if !req.param("video_category")
#   _id = ObjectId(req.param("_id"))
#   video_category = req.param("video_category")
#   db.collection(video_category).findAndModify {_id:_id},[],{ $inc: { play_nums: 1 } },(err) ->
#     return resErr res,err if err
#     return res.json {"success":true}


exports.video_play_numsadd = (req,res) ->
  return resErr res,'_id不得为空' if !req.param("_id")
  _id = ObjectId(req.param("_id"))
  db.collection("edu_video").findAndModify {_id:_id},[],{ $inc: { play_nums: 1 } },(err) ->
    return resErr res,err if err
    return res.json {"success":true}